/*
 *  Copyright 2004 Blandware (http://www.blandware.com)
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.blandware.atleap.webapp.form.core;

import com.blandware.atleap.webapp.form.BaseForm;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>ActionForm bean that holds selected and available roles and groups from lists
 * on the page with four HTML Selects with multiple attribute set to true</p>
 * <p><a href="SelectRolesAndGroupsForm.java.html"><i>View Source</i></a></p>
 *
 * @author Roman Puchkovskiy <a href="mailto:roman.puchkovskiy@blandware.com">
 *         &lt;roman.puchkovskiy@blandware.com&gt;</a>
 * @version $Revision: 1.1 $ $Date: 2006/03/06 18:12:33 $
 * @struts.form name="selectRolesAndGroupsForm"
 */
public class SelectRolesAndGroupsForm extends BaseForm {

	protected List availableRolesList;
	protected List selectedRolesList;

	protected String[] availableRoles;
	protected String[] selectedRoles;

	protected List availableGroupsList;
	protected List selectedGroupsList;

	protected String[] availableGroups;
	protected String[] selectedGroups;

	protected String version;

	/**
	 * Creates the new instance of SelectRolesAndGroupsForm
	 */
	public SelectRolesAndGroupsForm() {
	}

    /**
     * Returns list of available roles
     *
     * @return list of available roles
     */
	public List getAvailableRolesList() {
		return availableRolesList;
	}

    /**
     * Sets list of available roles
     *
     * @param availableRoles list of available roles
     */
	public void setAvailableRolesList(List availableRoles) {
		this.availableRolesList = availableRoles;
	}

    /**
     * Returns list of selected roles
     *
     * @return list of selected roles
     */
	public List getSelectedRolesList() {
		return selectedRolesList;
	}

    /**
     * Sets list of selected roles
     *
     * @param selectedRoles list of selected roles
     */
	public void setSelectedRolesList(List selectedRoles) {
		this.selectedRolesList = selectedRoles;
	}

    /**
     * Returns array of available roles
     *
     * @return array of available roles
     */
	public String[] getAvailableRoles() {
		return availableRoles;
	}

    /**
     * Sets array of available roles
     *
     * @param availableRoles array of available roles
     */
	public void setAvailableRoles(String[] availableRoles) {
		this.availableRoles = availableRoles;
	}

    /**
     * Returns array of selected roles
     *
     * @return array of selected roles
     */
	public String[] getSelectedRoles() {
		return selectedRoles;
	}

    /**
     * Sets array of selected roles
     *
     * @param selectedRoles array of selected roles
     */
	public void setSelectedRoles(String[] selectedRoles) {
		this.selectedRoles = selectedRoles;
	}

    /**
     * Returns list of available groups
     *
     * @return list of available groups
     */
	public List getAvailableGroupsList() {
		return availableGroupsList;
	}

    /**
     * Sets list of available groups
     *
     * @param availableGroups list of available roles
     */
	public void setAvailableGroupsList(List availableGroups) {
		this.availableGroupsList = availableGroups;
	}

    /**
     * Returns list of selected groups
     *
     * @return list of selected groups
     */
	public List getSelectedGroupsList() {
		return selectedGroupsList;
	}

    /**
     * Sets list of selected groups
     *
     * @param selectedGroups list of selected groups
     */
	public void setSelectedGroupsList(List selectedGroups) {
		this.selectedGroupsList = selectedGroups;
	}

    /**
     * Returns array of available groups
     *
     * @return array of available groups
     */
	public String[] getAvailableGroups() {
		return availableGroups;
	}

    /**
     * Sets array of available groups
     *
     * @param availableGroups array of available groups
     */
	public void setAvailableGroups(String[] availableGroups) {
		this.availableGroups = availableGroups;
	}

    /**
     * Returns array of selected groups
     *
     * @return array of selected groups
     */
	public String[] getSelectedGroups() {
		return selectedGroups;
	}

    /**
     * Sets array of selected groups
     *
     * @param selectedGroups array of selected groups
     */
	public void setSelectedGroups(String[] selectedGroups) {
		this.selectedGroups = selectedGroups;
	}

    /**
     * Returns version
     *
     * @return version
     */
	public String getVersion() {
		return version;
	}

    /**
     * Sets version
     *
     * @param version version to set
     */
	public void setVersion(String version) {
		this.version = version;
	}

	/**
	 * Resets all properties to their default values
	 *
	 * @param mapping The ActionMapping used to select this instance
	 * @param request The non-http request we are proceeding
	 */
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		availableRolesList = new ArrayList();
		selectedRolesList = new ArrayList();
		availableRoles = new String[0];
		selectedRoles = new String[0];
		availableGroupsList = new ArrayList();
		selectedGroupsList = new ArrayList();
		availableGroups = new String[0];
		selectedGroups = new String[0];
		version = null;
	}

	/**
	 * Form validation -- this form is always valid
	 *
	 * @param mapping The ActionMapping used to select this instance
	 * @param request The non-http request we are proceeding
	 * @return Instance of ActionErrors contains all validation errors
	 */
	public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
		return null;
	}

}